#pragma once
#include <stdint.h>
#include <vector>
#include <string>
#include <tuple>
#include <functional>
#include <zmq.hpp>

namespace RobotControl{
namespace Common{

/// \brief 消息发布
class MsgPublish
{
public:
	/// \brief 组件构造
	MsgPublish(zmq::context_t *ctx);

	/// \brief 配置主题
	bool config(const std::string &topic);

	/// \brief 配置主题
	/// \param[in] hwm: 消息溢出阈值
	bool config(const std::string &topic, const int32_t hwm);

	/// \brief 请求数据
	/// \param[in] req: 请求的数据
	/// \param[in] rep: 应答的数据
	void publish(zmq::message_t &pub);

private:
	zmq::socket_t m_socket;
	int32_t m_hwm;				///< 发布端的消息队列阈值, 防止使用内存过多
};

}	// Common
}	// RobotControl
